﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		ICommentService.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 //   File:            ICommentService.cs
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion
 

using System;
using System.Collections.Generic;
using System.Net.Mail;
using Dexter.Core.EventArgs;
using Dexter.DataTransferObject;
using Dexter.Domain.Model;

namespace Dexter.Services {
	/// <summary>
	/// 	Rapresents the gateway for all service to save, retrieve and manipulate data for <see cref = "Comment" />.
	/// </summary>
	public interface ICommentService {
		///<summary>
		///	Return a list approved comments, sorted by publish date.
		///</summary>
		///<param name = "numberOfItems">The number of items.</param>
		///<returns>
		///	Return a list of <see cref = "Comment" />.
		///	The return item could be null if there isn't items into the repository.
		///</returns>
		IEnumerable <Comment> GetRecent ( int numberOfItems );

		///<summary>
		///	Return a list approved comments, sorted by publish date.
		///</summary>
		///<param name = "numberOfItems">The number of items.</param>
		///<returns>
		///	Return a list of <see cref = "Comment" />.
		///	The return item could be null if there isn't items into the repository.
		///</returns>
		IList<CommentDto> GetRecentCommentDto(int numberOfItems);

		/// <summary>
		/// Adds the <see cref="Comment"/> for the specified post
		/// </summary>
		/// <param name="message">The message of the comment.</param>
		/// <param name="name">The name of the author of the comment.</param>
		/// <param name="email">The email of the author of the comment.</param>
		/// <param name="webSite">The web site of the author of the comment.</param>
		/// <param name="itemId">The <see cref="Item"/> id.</param>
		/// <param name="parentId">The id of the parent <see cref="Comment"/> .</param>
		void AddComment ( string message , string name , MailAddress email , Uri webSite , int itemId , int? parentId );

		/// <summary>
		/// 	Saves the specified comment into the repository.
		/// </summary>
		/// <param name = "item">The comment.</param>
		void Save(Comment item);

		/// <summary>
		/// 	This event will raise before a new <see cref = "Comment" /> processed by the implementation of <see cref = "AddComment" />.
		/// </summary>
		event EventHandler<CancelEventArgsWithOneParameter<Tuple<string, string, MailAddress, Uri,int,int?>>> CommentAdding;

		/// <summary>
		/// 	This event will raise after a new <see cref = "Comment" /> processed by the implementation of <see cref = "AddComment" />.
		/// </summary>
		event EventHandler<GenericEventArgs<Comment>> CommentAdded;


		/// <summary>
		/// 	This event will raise before a list of <see cref = "Comment" /> will be retrieved by the implementation of <see cref = "GetRecent(int)" />.
		/// </summary>
		event EventHandler <CancelEventArgsWithOneParameter <int>> RecentCommentRetrieving;

		/// <summary>
		/// 	This event will raise after a list of <see cref = "Comment" /> will be retrieved by the implementation of <see cref = "GetRecent(int)" />.
		/// </summary>
		event EventHandler <GenericEventArgs <IEnumerable <Comment>>> RecentCommentRetrieved;
	}
}
